<script lang="ts" setup>
import { User, Lock } from '@element-plus/icons-vue'
import { reactive } from 'vue';

const user = reactive({
    telephone: '',
    captcha: ''
})

const getCaptcha = () => {
    console.log('获取验证码')
}

const login = () => {
    console.log('登录')
}
</script>

<template>
    <el-card style="width: 400px; height: 250px;position: relative;top: 250px;opacity: 0.7">
        <h1 style="text-align: center">讯飞人工智能教育系统</h1>
        <el-form style="margin-top: 20px;">
            <el-form-item>
                <el-input :prefix-icon="User" placeholder="请输入手机号" v-model="user.telephone"></el-input>
            </el-form-item>

            <el-form-item>
                <div class="flex-container">
                    <el-input :prefix-icon="Lock" type="password" placeholder="请填写验证码" v-model="user.captcha"
                        @keydown.enter="login()" style="width: 250px;"></el-input>
                    <span class="captcha-button">
                        <el-button type="primary" @click="getCaptcha()">获取验证码</el-button>
                    </span>
                </div>
            </el-form-item>

            <el-form-item>

                <el-button style="width: 100%;" type="primary" @click="login()">登录</el-button>
            </el-form-item>
        </el-form>
    </el-card>
</template>

<style lang="scss" scoped>
.el-card {
    margin: -100px auto;

}

.flex-container {
    display: flex;
    /*justify-content: space-between;*/
    align-items: center;
    /* 使按钮与输入框垂直居中对齐 */
}

.captcha-button {
    margin-left: 10px;
    /* 调整间距，可以根据需要更改这个值 */
}
</style>